#include<iostream>
#include<stack>
using std::cout;using std::endl;
int main(){
        std::stack<int> s;
        s.push(1);
        cout<<"1 压入栈"<<endl;
        s.push(2);
        cout<<"2 压入栈"<<endl;
        s.push(3);
        cout<<"3 压入栈"<<endl;
        cout<<"栈的大小:"<<s.size()<<endl;
        cout<<"栈顶元素:"<<s.top()<<endl;
        cout<<"开始出栈"<<endl;
        while(!s.empty()){
        std::cout<<s.top()<<" ";//打印栈顶元素
        s.pop();//删除栈顶元素
    }
        s.empty()?cout<<"\n栈为空":cout<<"\n栈非空";
        return 0;
}
